<?php
	session_start();
	include_once "dev_con.inc.php";
	include_once "functions/class.query.inc.php";
	include_once "functions/func_content.php";
	include_once "langs/".BASE_LANGUAGE.'.inc.php';
	
	$queryData = new queryData();
	$queryData->baseConfig();
	
	if (defined('USE_GRAVATAR')) {
		$image = strip_tags($_GET['id']);
		$str = file_get_contents('http://www.gravatar.com/'.$image.'.php');
		$profile = unserialize($str);
		if (is_array($profile) && isset( $profile['entry'])) {
			$requestHash = $profile['entry'][0]['requestHash'];
			$title = $profile['entry'][0]['displayName'];
			$profileURl = $profile['entry'][0]['profileUrl']; 
			$preferredUsername = $profile['entry'][0]['preferredUsername'];
			$thumbnailUrl =  $profile['entry'][0]['thumbnailUrl'];
			$aboutMe = $profile['entry'][0]['aboutMe'];
			$currentLocation = $profile['entry'][0]['currentLocation'];
			$name = $profile['entry'][0]['name']; //array{givenName,familyName,formatted}
			$phoneNumbers = $profile['entry'][0]['phoneNumbers'];//array{0=>{array{type,value},dst}
			$emails = $profile['entry'][0]['emails'];//array{0=>array{primary,value},dst}
			$ims = $profile['entry'][0]['ims'];//array{0=>array{type,value},dst}
			$accounts = $profile['entry'][0]['accounts'];//array{0=>{domain,display,url,username,verified,shortname},dst}
			$urls = $profile['entry'][0]['urls'];//array{0=>array{value,title},dst}
			$photos = $profile['entry'][0]['photos']; //array{0,1,2,dst}
		}
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>aidiCMS Gravatar Profile : <?php echo $preferredUsername; ?></title>
<style type="text/css">
<!--
body { font:Tahoma, Geneva, sans-serif; font-size:12px; color:#000; background:url(images/grid_bg.gif) repeat}
a {text-decoration:none; color:#000}
a:hover {text-decoration:underline; color:#F30}
.fn {font-size:24px !important; margin:0; padding:0;}
.main {width:550px;}
.column-left {float: left;
width: 240px;
}
.clear {clear: both;
display: block;
}
.column-right {float: right;
width: 300px;
margin-bottom: 20px;
}
.column-right_large {float: right;
width: 300px;
margin-bottom: 20px;
}
.list-sites {margin: 0 0 5px -8px;
}
.column-bottom {float: right;
width: 300px;
margin-bottom: 20px;
}
-->
</style>
</head>

<body>
<div class="main">
  <div class="column-left">
    <h3>Contact Details</h3>
    <ul class="list-details">
      <li>Public Email
      </li>
        <?php
        foreach($ims as $num => $val) {
			switch ($val['type']) {
				case 'yahoo' : $data = 'ymsgr:sendim?';break;
				case 'gtalk' : $data = 'xmpp:';break;
				case 'jabber' : $data = 'xmpp:';break;
			}
		?>
      <li>Yahoo!
        <ul>
          <li><a href="<?php echo $data.$val['value']; ?>" title="<?php echo $val['type']; ?>" class="url"><?php echo $val['value']; ?></a> </li>
        </ul>
      </li>
      <?php } ?>
      <li class="tel"><span class="type">Cell</span> Phone
        <ul>
        <?php
        foreach($phoneNumbers as $num => $val) { 
		?>
          <li><a href="#" title="<?php echo ucfirst($val['type']); ?> Phone" class="value"><?php echo ucfirst($val['value']); ?></a></li>
         <?php } ?>
        </ul>
      </li>
    </ul>
    <h3>Verified Services</h3>
    <ul class="list-details">
    <?php 
	foreach($accounts as $num => $val) { 
	if ($val['verified']) {
	?>
      <li><span class="img accounts_<?php echo $val['shortname']; ?>" title="<?php echo ucfirst($val['shortname']); ?>">&nbsp;</span><a href="<?php echo $val['url']; ?>" class="accounts_<?php echo $val['shortname']; ?> url" title="<?php echo ucfirst($val['shortname']); ?>" rel="me nofollow"><?php echo ucfirst($val['display']); ?></a></li>
     <?php }} ?>
    </ul>
    <h3>Link To This Profile:</h3>
    <ul class="list-details">
    <li><?php echo '<a href="'.$profileURl.'" target="_blank">'.$profileURl.'</a>'; ?></li>
    </ul>
  </div>
  <div class="column-right">
    <div class="gallery-main"> <a href="#photo-0"> <img src="http://www.gravatar.com/avatar/<?php echo $requestHash; ?>?size=240" id="center-stage" alt="Photo" class="photo" /></a></div>
    <h2 class="fn"><?php echo $title; ?></h2>
    <?php echo $currentLocation; ?><br /><?php echo nl2br($aboutMe); ?>
  </div>
<div class="column-bottom">
    <h3>Personal Links</h3>
    <?php foreach($urls as $num => $val) { ?>
    <a href="<?php echo $val['value']; ?>" rel="nofollow" class="url"><img src="http://s.wordpress.com/mshots/v1/<?php echo urlencode($val['value']); ?>?w=115" width="115" alt="Screenshot" /><span></span></a>&nbsp;
    <?php } ?>
</div>
</div>
</body>
</html>